/*
 * @Author: Wushiqi
 * @Descripttion: 菜单、错误信息Id、消息个数
 * @Date: 2020-04-27 10:52:58
 * @LastEditTime: 2021-05-17 16:33:19
 */
const state = {
  menuList: [],
  messageId: '',
  msgNo: 0,
  initPwd: sessionStorage.initPwd ? JSON.parse(sessionStorage.initPwd) : false // 为true表示是初始密码,JSON.parse将字符串转成布尔值
}

const mutations = {
  get_menu(state) {
    state.menuList = sessionStorage.menu
  },
  turnTo_SysMessage(state, messageId) {
    state.messageId = messageId
  },
  get_msgNo(state, msgNo) {
    state.msgNo = msgNo
  },
  update_initPwd(state, init) {
    state.initPwd = init
    sessionStorage.setItem('initPwd', init)
  }
}

const actions = {
  turnToSysMessage({ commit }, messageId) {
    commit('turnTo_SysMessage', messageId)
  },
  getMsgNo({ commit }, msgNo) {
    commit('get_msgNo', msgNo)
  },
  updateInitPwd({ commit }, init) {
    commit('update_initPwd', init)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
